package com.xiaoxiao.ssos.base.aspect;

import com.xiaoxiao.ssos.base.annotations.Approval;
import com.xiaoxiao.ssos.base.utils.UserUtils;
import com.xiaoxiao.ssos.service.impl.FlowableServicelmpl;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName: ApprovalAspect
 * @Description: 自定义注解Approval支持
 * @Author: xwl
 * @Date: 2019-01-14 15:52
 * @Vsersion: 1.0
 */
@Aspect
@Component
public class ApprovalAspect {

    @Autowired
    private FlowableServicelmpl flowableServicelmpl;

    private Logger logger = LoggerFactory.getLogger(ApprovalAspect.class);
    @Around("@annotation(approval)")
    public Object start(ProceedingJoinPoint joinPoint,Approval approval){

        flowableServicelmpl.addTask(UserUtils.getUserId()+"",approval.value(),"");
        return null;
    }
}
